package com.xinliu.fastchat.domain.core;

/*
 @author: xinliu
 @email: 3536370493@qq.com
 @time : 2025/9/18 0:35
*/

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class R<T> {

    private Integer code;

    private String msg;

    private T data;

    public static <T> R<T> ok() {
        return new R<T>(1, "请求成功", null);
    }

    public static <T> R<T> ok(T data) {
        return new R<T>(1, "请求成功", data);
    }

    public static <T> R<T> error() {
        return new R<T>(0, "请求失败", null);
    }

    public static <T> R<T> error(String msg) {
        return new R<T>(0, msg, null);
    }
}
